
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class IntroFrame extends JFrame implements MouseListener,  WindowListener
{
	humanHuman humanHuman;
	humanRobot humanRobot;
	exit exit;

	playersInfoEntry playersInfoEntry = new playersInfoEntry();
	singlePlayerInfoEntry singlePlayerInfoEntry = new singlePlayerInfoEntry();

	LabelContentPane contentPane = new LabelContentPane();

	BoardFrame boardFrame = new BoardFrame();

	public IntroFrame()
	{
		super("Nine Men's Morris");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setContentPane(contentPane);
		setJMenuBar(new MainMenu());
		setBounds(180,70,750,600);
		setResizable(false);

		humanHuman = new humanHuman();
		humanHuman.addMouseListener(this);
		contentPane.add(humanHuman);
		System.out.println(humanHuman.isLightweight());

		humanRobot = new humanRobot();
		contentPane.add(humanRobot);
		humanRobot.addMouseListener(this);

		exit = new exit();
		contentPane.add(exit);
		exit.addMouseListener(this);

		playersInfoEntry.back.addMouseListener(this);
		playersInfoEntry.forward.addMouseListener(this);

		singlePlayerInfoEntry.back.addMouseListener(this);
		singlePlayerInfoEntry.forward.addMouseListener(this);

		boardFrame.addWindowListener(this);

	}

	public void mousePressed(MouseEvent e)
	{
	}

	public void mouseReleased(MouseEvent e)
	{
		if(e.getSource() == humanHuman && humanHuman.isEnabled() == true)
		{
			contentPane.add(playersInfoEntry);
			humanRobot.setEnabled(false);
			playersInfoEntry.setVisible(true);
		}
		else
		{
			if(e.getSource() == humanRobot && humanRobot.isEnabled() == true)
			{
				contentPane.add(singlePlayerInfoEntry);
				humanHuman.setEnabled(false);
				singlePlayerInfoEntry.setVisible(true);
			}
			else
			{
				if(e.getSource() == playersInfoEntry.back)
				{
					playersInfoEntry.setVisible(false);
					humanHuman.setVisible(true);
					humanHuman.setEnabled(true);
					humanRobot.setEnabled(true);
				}
				else
				{
					if(e.getSource() == playersInfoEntry.forward)
					{
						setVisible(false);
						boardFrame = new BoardFrame();
						boardFrame.setVisible(true);
						boardFrame.setStatus(playersInfoEntry);
					}
					else
					{
						if(e.getSource() == singlePlayerInfoEntry.forward)
						{
							setVisible(false);
							boardFrame = new BoardFrame();
							boardFrame.setVisible(true);
							boardFrame.setStatus(singlePlayerInfoEntry);
						}
						else
						{
							if(e.getSource() == singlePlayerInfoEntry.back)
							{
								singlePlayerInfoEntry.setVisible(false);
								humanRobot.setVisible(true);
								humanHuman.setEnabled(true);
								humanRobot.setEnabled(true);
							}
						}
					}
				}
			}
		}
	}

	public void mouseEntered(MouseEvent e)
	{
	}

	public void mouseExited(MouseEvent e)
	{
	}

	public void mouseClicked(MouseEvent e)
	{
	}

	public void windowActivated(WindowEvent e)
	{
	}

	public void windowClosed(WindowEvent e)
	{
	}

	public void windowClosing(WindowEvent e)
	{
	}

	public void windowDeactivated(WindowEvent e)
	{
	}

	public void windowDeiconified(WindowEvent e)
	{
	}

	public void windowIconified(WindowEvent e)
	{
	}

	public void windowOpened(WindowEvent e)
	{
	}

}
